package com.silence.gankio.mvp.model

import com.silence.gankio.bean.GankIoBean
import com.silence.gankio.core.net.HttpUtil
import com.silence.gankio.mvp.control.IControl
import com.silence.gankio.net.GankIoObserver
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

open class BaseModel : IControl.IModel {

    protected fun <T> HttpUtil.rx(observable: Observable<GankIoBean<T>>, observer: GankIoObserver<T>) {
        return observable.subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(observer)
    }

}